<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<{include file='backend/lib/meta.html'}>
<link rel="stylesheet" type="text/css" href="public/theme/backend/css/verydows.css" />
<link rel="stylesheet" type="text/css" href="public/theme/backend/css/main.css" />
<script type="text/javascript" src="public/script/jquery.js"></script>
<script type="text/javascript" src="public/theme/backend/js/verydows.js"></script>
<script type="text/javascript">
function submitForm(btn){
  $('#username').vdsFieldChecker({
    rules:{required:[true, '请设置用户名'], username:[/^[a-zA-Z][_a-zA-Z0-9]{4,15}$/.test($('#username').val()), '用户名不符合格式要求']},
    tipsPos:'abs',
  });
  $('#email').vdsFieldChecker({
    rules:{required:[true, '请设置邮箱'], email:[true, '无效的邮箱地址'], maxlen:[60, '邮箱地址不能超过60个字符']}, 
    tipsPos:'abs',
  });
  $('#password').vdsFieldChecker({
    rules:{required:[true, '请设置密码'], password:[true, '密码不符合格式要求']}, 
    tipsPos:'abs',
  });
  $('#repassword').vdsFieldChecker({
    rules:{equal:[$('#password').val(), '两次密码不一致']}, 
    tipsPos:'abs',
  });
  
  $('#register-form').vdsFormChecker({
    beforeSubmit: function(){
      $(btn).addClass('disabled').text('正在提交...').prop('disabled', true);
    }
  });
}
</script>
</head>
<body>
<div class="content">
  <div class="loc"><h2><i class="icon"></i>添加新用户</h2></div>
  <form method="post" action="<{url m=$MOD c='user' a='add' step='submit'}>"  id="register-form">
    <div class="box">
      <div class="module">
        <table class="dataform">
          <tr>
            <th width="110">用户名称</th>
            <td><input class="w200 txt" name="username" id="username" type="text" /></td>
          </tr>
          <tr>
            <th>邮箱：</th>
            <td><input class="w200 txt" name="email" id="email" type="text" /></td>
          </tr>
          <tr>
            <th>设置密码：</th>
            <td>
              <input class="w200 txt" name="password" id="password" type="password" value="" />
            </td>
          </tr>
		  <tr>
            <th>确认密码：</th>
            <td>
              <input class="w200 txt" name="repassword" id="repassword" type="password" value="" />
            </td>
          </tr>
        </table>
      </div>
      <div class="submitbtn">
        <button type="button" class="ubtn btn" onclick="submitForm(this)">保存并提交</button>
        <button type="reset" class="fbtn btn">重置表单</button>
      </div>
    </div>
  </form>
</div>
</body>
</html>